Skip to content

Closes #865 - Add get_changed_items() utility for git-based selective deployment#891

Open
vipulb91 wants to merge 1 commit intomicrosoft:mainfrom
vipulb91:feature/get-changed-items
Open

Closes #865 - Add get_changed_items() utility for git-based selective deployment#891
vipulb91 wants to merge 1 commit intomicrosoft:mainfrom
vipulb91:feature/get-changed-items

Conversation

@vipulb91
Copy link
Copy Markdown

Description

Briefly describe what this PR does and why.

Adds a new public utility function get_changed_items() to support git-based selective deployment of Fabric items.

Linked Issue (REQUIRED)

#865

Motivation

Closes #865. Users running CI/CD pipelines with fetchDepth: 2 (or similar shallow clones) want to deploy only the items that changed in a given commit/ref, rather than publishing all items every time.

## Approach (Option 2 — Decoupled) - Discussed in comment section with @shirasassoon

Rather than adding changed_only / git_compare_ref parameters directly to publish_all_items() and unpublish_all_orphan_items() (Option 1), this PR exposes the git-diff logic as a standalone utility function. This keeps the core publishing functions clean and allows users to compose the deployment logic themselves.

New API

from fabric_cicd import get_changed_items

changed = get_changed_items(repository_directory, git_compare_ref="HEAD~1")
# Returns a list of item names that were added/modified/renamed

if changed:
    publish_all_items(workspace, items_to_include=changed)

@vipulb91
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@shirasassoon
Copy link
Copy Markdown
Contributor

@vipulb91 Thanks for submitting this PR, let's make sure the branch is updated completely. I did a quick scan and noticed some code was getting unintentionally removed. Happy to review once everything is up to date.

@vipulb91 vipulb91 force-pushed the feature/get-changed-items branch from c3cafc2 to be1c79b Compare April 1, 2026 08:58
@vipulb91
Copy link
Copy Markdown
Author

vipulb91 commented Apr 1, 2026

@shirasassoon - Thanks for the heads up! The branch was behind main by several commits, which was making the diff look like code was being removed — that was a red herring from the stale base.

I've rebased onto the latest main and force-pushed. The diff should now cleanly show only the additions:

  • New get_changed_items() function in publish.py
  • Export in init.py
  • Documentation in optional_feature.md
  • 6 new unit tests in test_publish.py
  • Changie entry

All 35 tests pass (including the new file-sorting tests added upstream). Happy to make any adjustments based on your review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add changed_only support for git-diff-based selective deployment

2 participants